From 12bea7a9d5394bbad920278e74a6375ebe480d94 Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Fri, 28 Sep 2007 14:03:06 +0000 Subject: [PATCH] Use same typnames as schema for ease. Put added column before column type checks. --- includes/DatabasePostgres.php | 7 ++++- maintenance/updaters.inc | 57 ++++++++++++++++++----------------- 2 files changed, 35 insertions(+), 29 deletions(-) diff --git a/includes/DatabasePostgres.php b/includes/DatabasePostgres.php index 3bc36f3431..143443771f 100644 --- a/includes/DatabasePostgres.php +++ b/includes/DatabasePostgres.php @@ -16,7 +16,12 @@ class PostgresField { global $wgDBmwschema; $q = <<query("ALTER TABLE $nc[0] ADD $nc[1] $nc[2]"); } + ## Needed before column changes + if (is_null($wgDatabase->fieldInfo("archive", "ar_deleted"))) { + echo "... add archive.ar_deleted\n"; + dbsource(archive("patch-archive-ar_deleted.sql")); + } else + echo "... archive.ar_deleted already exists\n"; + foreach ($typechanges as $tc) { $fi = $wgDatabase->fieldInfo($tc[0], $tc[1]); if (is_null($fi)) { @@ -1455,7 +1462,7 @@ function do_postgres_updates() { } } - if ($wgDatabase->fieldInfo('oldimage','oi_deleted') !== 'smallint') { + if ($wgDatabase->fieldInfo('oldimage','oi_deleted')->type() !== 'smallint') { echo "... change oldimage.oi_deleted to smallint"; $wgDatabase->query("ALTER TABLE oldimage ALTER oi_deleted DROP DEFAULT"); $wgDatabase->query("ALTER TABLE oldimage ALTER oi_deleted TYPE SMALLINT USING (oi_deleted::smallint)"); @@ -1518,12 +1525,6 @@ function do_postgres_updates() { dbsource(archive('patch-revision_rev_user_fkey.sql')); } - if (is_null($wgDatabase->fieldInfo("archive", "ar_deleted"))) { - echo "... add archive.ar_deleted\n"; - dbsource(archive("patch-archive-ar_deleted.sql")); - } else - echo "... archive.ar_deleted already exists\n"; - global $wgExtNewTables, $wgExtPGNewFields, $wgExtNewIndexes; # Add missing extension tables foreach ( $wgExtNewTables as $nt ) { -- 2.20.1